using System;
using System.Reflection;

namespace Framework
{
    [AttributeUsage(AttributeTargets.Field)]
    internal class TargetNameAttribute : Attribute
    {
        internal static string GetName(Targets t)
        {
            FieldInfo f = typeof (Targets).GetField(Enum.GetName(typeof (Targets), t));
            var n = (TargetNameAttribute)GetCustomAttribute(f, typeof (TargetNameAttribute));
            return n == null ? null : n.Value;
        }

        private readonly string _name;

        internal TargetNameAttribute(string name)
        {
            this._name = name;
        }

        internal string Value
        {
            get { return this._name; }
        }
    } ;
}
